<?php

namespace App\Http\Controllers\Mini;

use App\Http\Controllers\BasicOwnerController;
use App\Http\Requests\Mini\Estate\PayRequest;
use App\Services\PaymentOrderService;
use Illuminate\Http\Request;

class PaymentOrderController extends BasicOwnerController
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    /**
     * 2021/3/18--9:12
     * @effect:添加订单操作
     * @param PayRequest $request
     * @param PaymentOrderService $order_service
     * @author:苏冬冬
     * @QQ:1299273928
     * @method:store
     */
    public function store(PayRequest $request, PaymentOrderService $order_service)
    {
        if (!$this->owner) {
            $this->error("未找到业主");
        }
        $result = $order_service->add_order($request, $this->owner, $this->user);
        return $result['status'] ? $this->success($result['data'], "创建订单成功") : $this->error($result['msg']);
    }

    /**
     * Display the specified resource.
     *
     * @param $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param Request $request
     * @param $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
